package cn.iocoder.yudao.module.aiposter.dal.mysql.template;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.aiposter.dal.dataobject.template.TemplateDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.aiposter.controller.admin.template.vo.*;

/**
 * 海报信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface TemplateMapper extends BaseMapperX<TemplateDO> {

    default PageResult<TemplateDO> selectPage(TemplatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TemplateDO>()
                .eqIfPresent(TemplateDO::getTitle, reqVO.getTitle())
                .likeIfPresent(TemplateDO::getBizName, reqVO.getBizName())
                .likeIfPresent(TemplateDO::getKeyword, reqVO.getKeyword())
                .eqIfPresent(TemplateDO::getCover, reqVO.getCover())
                .eqIfPresent(TemplateDO::getData, reqVO.getData())
                .eqIfPresent(TemplateDO::getWidth, reqVO.getWidth())
                .eqIfPresent(TemplateDO::getHeight, reqVO.getHeight())
                .eqIfPresent(TemplateDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(TemplateDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TemplateDO::getId));
    }

}